fldmeta_prop.func.UserTask = {};
fldmeta_prop.func.UserTask.predefined = {};

//选择指定用户
/*fldmeta_prop.func.UserTask.selectUser = function(rId, cId) {

 var w1 = fm_createCenterWindow('wid_selectUser', fmd_i18n_prop_selworker, 800, 600);

 var lo1 = w1.attachLayout("2E");
 lo1.cells('a').hideHeader();
 lo1.cells('b').hideHeader();
 lo1.cells('b').setHeight(50);
 lo1.cells('a').attachHTMLString('<div id="userSelIframeLI" class="wait"><img src="'+flvar.imagepath+'/loading.gif"></div>'+
 '<iframe style="width:100%;height:100%;border:0px" id="userSelIframe" name="userSelIframe"></iframe>');
 $("#userSelIframeLI").show();

 var str2 = [
 { type:"block" , name:"form_block_1", offsetLeft:(dhx_skin=="dhx_web"?"333":"337"), offsetTop:"0", list:[
 { type:"button" , name:"fb_ok", value:fmd_i18n_b_ok, inputTop:0  }
 ]  }
 ];
 var fm2 = lo1.cells('b').attachForm(str2);

 fm2.attachEvent("onButtonClick", function(btid) {
 if (btid=='fb_ok') {
 var v_value = window.frames["userSelIframe"].getValueOfStr();
 fmdc.grid_prop.cells(rId, cId).setValue(v_value, true);
 w1.close();
 }
 });

 $("#userSelIframe").load(function(){
 $("#userSelIframeLI").hide();
 }).attr("src", flvar.popupSelectorUser);//?isDialog=true

 };*/
fldmeta_prop.func.UserTask.selectUser = function (rId, cId) {

    var w1 = fm_createCenterWindow('wid_selectUser', fmd_i18n_prop_selworker, 800, 600);

    var lo1 = w1.attachLayout("2E", dhx_skin);
    lo1.cells('a').hideHeader();
    lo1.cells('b').hideHeader();
    lo1.cells('b').setHeight(50);
    var loa = lo1.cells('a').attachLayout('2U', dhx_skin);
    loa.cells('a').setWidth(280);
    loa.cells('a').hideHeader();
    loa.cells('b').hideHeader();

    var tree1 = loa.cells('a').attachTree();
    tree1.setSkin(dhx_skin);
    tree1.setImagePath(dhtmlx.image_path + 'dhxtree_terrace/');
    var types = {};

    //grid
    var stb = loa.cells('b').attachStatusBar();
    stb.setText("<div id='id_selectUser_paging_stb1'></div>");
    var ragrid = loa.cells('b').attachGrid();
    ragrid.setHeader([fmd_i18n_order,
            "LOGIN_NAME",
            fmd_i18n_prop_name,
            fmd_i18n_prop_type],
        null,
        ["text-align:center;",
            "text-align:center;",
            "text-align:center;",
            "text-align:center;"]);
    ragrid.attachHeader("#rspan,&nbsp;," +
        "<input id='sr_boname' type='text' style='width:90%'/>,#rspan");
    ragrid.setInitWidths("60,60,300,100");
    ragrid.setColumnIds("NO,LOGIN_NAME,DISPLAY_NAME,TYPE");
    ragrid.setColTypes("ro,ro,ro,ro");
    ragrid.setColSorting("int,na,str,str");
    ragrid.setColumnsVisibility("false,true,false,false");
    ragrid.setColAlign("center,left,left,left");
    ragrid.setEditable(false);
    ragrid.setLang(flvar.lang);

    //paging
    ragrid.setPagingWTMode(true, true, true, [10, 20, 50, 100]);
    ragrid.enablePaging(true, 10, 5, 'id_selectUser_paging_stb1');
    ragrid.setPagingSkin("toolbar", dhx_skin);

    //default ordering
    ragrid.grid_setOrderColumns([{"LOGIN_NAME": "ASC"}]);

    ragrid.init();

    ragrid.attachEvent("onPageChanged", function (ind, fInd, lInd) {
        bom_toPage(fInd + 1, lInd);
    });

    //header click event
    ragrid.attachEvent("onHeaderClick", grid_onHeaderClick);

    ragrid.attachEvent("onRowDblClicked", function (rid) {
        var newval = {
            "loginName": ragrid.cells(rid, 1).getValue(),
            "ids": ragrid.cells(rid, 1).getValue(),
            "displayName": ragrid.cells(rid, 2).getValue(),
            "names": ragrid.cells(rid, 2).getValue()
        };
        fmdc.grid_prop.cells(rId, cId).setValue(newval, true);	//第二个参数必须为true，触发事件
        w1.close();
    });

    //bind searcher event
    //disable onclick order by function for this header
    var trsr_boname = $("#sr_boname").parents('tr:first');
    trsr_boname.find('td').bind('click', bom_stopEvent);
    trsr_boname.find('td').bind('mouseover', bom_stopEvent);
    $("#sr_boname").bind('keypress', bom_enterQuery);

    //call query bo
    function bom_enterQuery(e) {
        if (e.keyCode == 13) {
            ragrid.displayName = $.trim($("#sr_boname").val());
            bom_toPage(1, 10);
        }
    }

    //query bo
    function bom_toPage(fromRow, toRow) {
        lo1.progressOn();
        var p = {
            "queryParams": {}, "fromRow": fromRow, "toRow": toRow, "timezoneOffset": new Date().getTimezoneOffset(),
            "ordercolumns": JSON.stringify(ragrid._grid_ordercolumns)
        };
        ragrid.displayName && (p.queryParams.displayName = ragrid.displayName);
        p.queryParams = JSON.stringify(p.queryParams);
        var ret = doPostAsyncJson(flvar.restCtx + '/fa/org/' + ragrid.orgId + '/usersDhx?timezoneOffset=' + new Date().getTimezoneOffset(),
            p,
            function (ret) {
                if (!ret || !ret.rows) {
                    lo1.progressOff();
                    msgErr(fmd_i18n_msg_readfail);
                    return;
                }
                if (ret.rows) {
                    for (var i in ret.rows) {
                        ret.rows[i].data[3] = fmd_i18n_prop_enu_userType[ret.rows[i].data[3]];
                    }
                }
                ragrid.clearAllInPaging();
                ragrid.parse(ret, "json");
                lo1.progressOff();
            });
    }

    //stop event propagation
    function bom_stopEvent(e) {
        if (e && e.stopPropagation != undefined) {
            e.stopPropagation();
        } else if (window.event) {
            window.event.cancelBubble = true;
        }
        return false;
    }

    var str2 = [
        {
            type: "block",
            name: "form_block_1",
            offsetLeft: (dhx_skin == "dhx_web" ? "333" : "337"),
            offsetTop: "0",
            list: [
                {type: "button", name: "fb_ok", value: fmd_i18n_b_ok, inputTop: 0}
            ]
        }
    ];
    var fm2 = lo1.cells('b').attachForm(str2);

    fm2.attachEvent("onButtonClick", function (btid) {
        if (btid == 'fb_ok') {
            var rid = ragrid.getSelectedRowId();
            if (!rid) {
                msg(fmd_i18n_prop_msg_plsselline);
                return;
            }
            var newval = {
                "loginName": ragrid.cells(rid, 1).getValue(),
                "displayName": ragrid.cells(rid, 2).getValue(),
                "ids": ragrid.cells(rid, 1).getValue(),
                "names": ragrid.cells(rid, 2).getValue()
            };
            fmdc.grid_prop.cells(rId, cId).setValue(newval, true);	//第二个参数必须为true，触发事件
            w1.close();
        }
    });

    tree1.attachEvent('onSelect', function (itemId) {
        if (!itemId || itemId == 'ROOT') return;
        ragrid.orgId = itemId;
        bom_toPage(1, 10);
    });

    var ret = doGetAsyncJson(flvar.restCtx + '/fa/orgs/allByTenant?timezoneOffset=' + new Date().getTimezoneOffset(),
        function (ret) {
            if (!ret) {
                lo1.progressOff();
                msgErr(fmd_i18n_msg_readfail);
                return;
            }
            var td = initOrgPosTreeData(ret);
            tree1.loadJSONObject(td, function () {
                tree1.openItem('ROOT')
            });
            lo1.progressOff();
        });

    function initOrgPosTreeData(ret) {
        var data1 = {};
        for (var i in ret) {
            data1[ret[i].id] = ret[i];
        }
        function findChildren(root, data) {
            if (data) {
                for (var i in data) {
                    if (data[i].parent == root.id) {
                        var child = {id: data[i].id, text: data[i].text};
                        types[data[i].id] = data[i].type;
                        if (data[i].type == '10') {
                            child.im0 = 'orgCompany.png';
                            child.im1 = 'orgCompany.png';
                            child.im2 = 'orgCompany.png';
                        } else if (data[i].type == '20') {
                            child.im0 = 'orgDept.png';
                            child.im1 = 'orgDept.png';
                            child.im2 = 'orgDept.png';
                        }
                        delete data[i];
                        findChildren(child, data);
                        root.item = root.item || [];
                        root.item.push(child);
                    }
                }
            }
        }

        var root = {
            id: 0,
            text: '',
            item: [{id: 'ROOT', text: fmd_i18n_prop_allorg, im0: 'orgAll.png', im1: 'orgAll.png', im2: 'orgAll.png'}]
        };
        findChildren(root.item[0], data1);
        //console.log(JSON.stringify(root));
        return root;
    }
};

//选择指定角色
fldmeta_prop.func.UserTask.selectRole = function (rId, cId) {
    var w1 = fm_createCenterWindow('wid_selectRole', fmd_i18n_prop_selrole, 600, 600);
    var bom = {};

    var lo1 = w1.attachLayout("2E");
    lo1.cells('a').hideHeader();
    lo1.cells('b').hideHeader();
    lo1.cells('b').setHeight(50);
    bom.stb = lo1.cells('a').attachStatusBar();
    bom.stb.setText("<div id='id_selectRole_paging_stb1'></div>");

    var str2 = [
        {
            type: "block",
            name: "form_block_1",
            offsetLeft: (dhx_skin == "dhx_web" ? "233" : "237"),
            offsetTop: "0",
            list: [
                {type: "button", name: "fb_ok", value: fmd_i18n_b_ok, inputTop: 0}
            ]
        }
    ];
    var fm2 = lo1.cells('b').attachForm(str2);

    //grid
    var ragrid = lo1.cells('a').attachGrid();
    ragrid.setHeader([fmd_i18n_order,
            "ROLE_ID",
            fmd_i18n_prop_selrole,
            fmd_i18n_prop_description],
        null,
        ["text-align:center;",
            "text-align:center;",
            "text-align:center;",
            "text-align:center;"]);
    ragrid.attachHeader("#rspan,&nbsp;," +
        "<input id='sr_boname' type='text' style='width:90%'/>," +
        "<input id='sr_bodesc' type='text' style='width:90%'/>");
    ragrid.setInitWidths("60,60,200,280");
    ragrid.setColumnIds("NO,ROLE_ID,ROLE_NAME,ROLE_DESC");
    ragrid.setColTypes("ro,ro,ro,ro");
    ragrid.setColSorting("int,na,str,str");
    ragrid.setColumnsVisibility("false,true,false,false");
    ragrid.setColAlign("center,left,left,left");
    ragrid.setEditable(false);
    ragrid.setLang(flvar.lang);

    //paging
    ragrid.setPagingWTMode(true, true, true, [10, 20, 50, 100]);
    ragrid.enablePaging(true, 10, 5, 'id_selectRole_paging_stb1');
    ragrid.setPagingSkin("toolbar", dhx_skin);

    //default ordering
    ragrid.grid_setOrderColumns([{"CREATE_TIME": "DESC"}]);

    ragrid.init();

    ragrid.attachEvent("onPageChanged", function (ind, fInd, lInd) {
        bom_toPage(fInd + 1, lInd);
    });

    //header click event
    ragrid.attachEvent("onHeaderClick", grid_onHeaderClick);

    ragrid.attachEvent("onRowDblClicked", function (rid) {
        var newval = {
            "roleId": ragrid.cells(rid, 1).getValue(),
            "roleName": ragrid.cells(rid, 2).getValue()
        };
        fmdc.grid_prop.cells(rId, cId).setValue(newval, true);	//第二个参数必须为true，触发事件
        w1.close();
    });

    fm2.attachEvent("onButtonClick", function (btid) {
        if (btid == 'fb_ok') {
            var rid = ragrid.getSelectedRowId();
            if (!rid) {
                msg(fmd_i18n_prop_msg_plsselline);
                return;
            }
            var newval = {
                "roleId": ragrid.cells(rid, 1).getValue(),
                "roleName": ragrid.cells(rid, 2).getValue()
            };
            fmdc.grid_prop.cells(rId, cId).setValue(newval, true);	//第二个参数必须为true，触发事件
            w1.close();
        }
    });

    //bind searcher event
    //disable onclick order by function for this header
    var trsr_boname = $("#sr_boname").parents('tr:first');
    trsr_boname.find('td').bind('click', bom_stopEvent);
    trsr_boname.find('td').bind('mouseover', bom_stopEvent);
    $("#sr_boname").bind('keypress', bom_enterQuery);
    $("#sr_bodesc").bind('keypress', bom_enterQuery);

    //query
    bom_toPage(1, 10);

    //call query bo
    function bom_enterQuery(e) {
        if (e.keyCode == 13) {
            bom.boquery_boname = $.trim($("#sr_boname").val());
            bom.boquery_bodesc = $.trim($("#sr_bodesc").val());
            bom_toPage(1, 10);
        }
    }

    //query bo
    function bom_toPage(fromRow, toRow) {
        lo1.progressOn();
        var p = {
            "queryParams": {"roleType":"2"}, "fromRow": fromRow, "toRow": toRow, "timezoneOffset": new Date().getTimezoneOffset(),
            "ordercolumns": JSON.stringify(ragrid._grid_ordercolumns)
        };
        bom.boquery_boname && (p.queryParams.roleName = bom.boquery_boname);
        bom.boquery_bodesc && (p.queryParams.roleDesc = bom.boquery_bodesc);
        p.queryParams = JSON.stringify(p.queryParams);
        var ret = doPostAsyncJson(flvar.restCtx + '/fa/role/queryDhx', p, function (ret) {
            if (!ret) {
                lo1.progressOff();
                msgErr(fmd_i18n_msg_readfail);
                return;
            }
            ragrid.clearAllInPaging();
            ragrid.parse(ret, "json");
            lo1.progressOff();
        });
    }

    //stop event propagation
    function bom_stopEvent(e) {
        if (e && e.stopPropagation != undefined) {
            e.stopPropagation();
        } else if (window.event) {
            window.event.cancelBubble = true;
        }
        return false;
    }
};

//选择指定岗位
/*fldmeta_prop.func.UserTask.selectPosition = function(rId, cId) {
 //TODO
 var w1 = fm_createCenterWindow('wid_selectpost', fmd_i18n_prop_selposition, 600, 400);

 var lo1 = w1.attachLayout("2E");
 lo1.cells('a').hideHeader();
 lo1.cells('b').hideHeader();
 lo1.cells('b').setHeight(50);
 lo1.cells('a').attachHTMLString('<div id="postSelIframeLI" class="wait"><img src="'+flvar.imagepath+'/loading.gif"></div>'+
 '<iframe style="width:100%;height:100%;border:0px" id="postSelIframe" name="postSelIframe"></iframe>');
 $("#postSelIframeLI").show();

 var str2 = [
 { type:"block" , name:"form_block_1", offsetLeft:(dhx_skin=="dhx_web"?"233":"237"), offsetTop:"0", list:[
 { type:"button" , name:"fb_ok", value:fmd_i18n_b_ok, inputTop:0  }
 ]  }
 ];
 var fm2 = lo1.cells('b').attachForm(str2);

 fm2.attachEvent("onButtonClick", function(btid) {
 if (btid=='fb_ok') {
 var v_value = window.frames["postSelIframe"].getValueOfStr();
 console.log(v_value.msg+' '+v_value.posName);
 if(v_value.msg){

 }else{
 fmdc.grid_prop.cells(rId, cId).setValue(v_value, true);
 w1.close();
 }
 }
 });

 $("#postSelIframe").load(function(){
 $("#postSelIframeLI").hide();
 }).attr("src", ctxpath + '/jsp/platform/permission/selectpost_fs.jsp');//?isDialog=true

 };*/

fldmeta_prop.func.UserTask.selectPosition = function (rId, cId) {
    var w1 = fm_createCenterWindow('wid_selectpost', fmd_i18n_prop_assignee_position, 400, 600);

    var lo1 = w1.attachLayout("2E");
    lo1.cells('a').hideHeader();
    lo1.cells('b').hideHeader();
    lo1.cells('b').setHeight(50);

    var tb1 = lo1.cells('a').attachToolbar();
    tb1.addInput('id_searcher', 0, '', 150);
    tb1.addText('id_searcher_label', 0, fmd_i18n_prop_pgsearch);

    var tree1 = lo1.cells('a').attachTree();
    tree1.setSkin(dhx_skin);
    tree1.setImagePath(dhtmlx.image_path + 'dhxtree_terrace/');

    var types = {};

    var ret = doGetAsyncJson(flvar.restCtx + '/fa/orgs/allByTenantWithPos?timezoneOffset=' + new Date().getTimezoneOffset(),
        function (ret) {
            if (!ret) {
                lo1.progressOff();
                msgErr(fmd_i18n_msg_readfail);
                return;
            }
            var td = initOrgPosTreeData(ret);
            tree1.loadJSONObject(td, function () {
                tree1.openItem('ROOT')
            });
            lo1.progressOff();
        });

    function initOrgPosTreeData(ret) {
        var data1 = {};
        for (var i in ret) {
            data1[ret[i].id] = ret[i];
        }
        function findChildren(root, data) {
            if (data) {
                for (var i in data) {
                    if (data[i].parent == root.id) {
                        var child = {id: data[i].id, text: data[i].text};
                        types[data[i].id] = data[i].type;
                        if (data[i].type == 'POS') {
                            child.im0 = 'orgPos.png';
                            child.im1 = 'orgPos.png';
                            child.im2 = 'orgPos.png';
                        } else if (data[i].type == '10') {
                            child.im0 = 'orgCompany.png';
                            child.im1 = 'orgCompany.png';
                            child.im2 = 'orgCompany.png';
                        } else if (data[i].type == '20') {
                            child.im0 = 'orgDept.png';
                            child.im1 = 'orgDept.png';
                            child.im2 = 'orgDept.png';
                        }
                        delete data[i];
                        findChildren(child, data);
                        root.item = root.item || [];
                        root.item.push(child);
                    }
                }
            }
        }

        var root = {
            id: 0,
            text: '',
            item: [{id: 'ROOT', text: fmd_i18n_prop_allorg, im0: 'orgAll.png', im1: 'orgAll.png', im2: 'orgAll.png'}]
        };
        findChildren(root.item[0], data1);
        //console.log(JSON.stringify(root));
        return root;
    }

    var str2 = [
        {
            type: "block",
            name: "form_block_1",
            offsetLeft: (dhx_skin == "dhx_web" ? "133" : "137"),
            offsetTop: "0",
            list: [
                {type: "button", name: "fb_ok", value: fmd_i18n_b_ok, inputTop: 0}
            ]
        }
    ];
    var fm2 = lo1.cells('b').attachForm(str2);

    function returnVal(itemId) {
        var ids = itemId.split("_");
        var newv = {};
        newv.orgId = ids[0];
        newv.orgName = tree1.getItemText(ids[0]);
        newv.posId = ids[1];
        newv.posName = tree1.getItemText(itemId);
        newv.displayValue = newv.orgName + ' - ' + newv.posName;
        fmdc.grid_prop.cells(rId, cId).setValue(newv, true);
        w1.close();
    }

    tree1.attachEvent('onDblClick', function (itemId) {
        if (types[itemId] == 'POS') {
            returnVal(itemId);
        }
    });

    tb1.attachEvent('onEnter', function (itemId, value) {
        if (itemId == 'id_searcher' && $.trim(value)) {
            tree1.findItem($.trim(value), 0, 0);
        }
    });

    fm2.attachEvent("onButtonClick", function (btid) {
        if (btid == 'fb_ok') {
            var itemId = tree1.getSelectedItemId();
            if (!itemId || types[itemId] != 'POS') {
                msg(fmd_i18n_msg_plsselpos);
                return;
            }
            returnVal(itemId);
        }
    });
};

fldmeta_prop.func.UserTask.selectPgPosition = function (rId, cId) {
    var w1 = fm_createCenterWindow('wid_selectpost', fmd_i18n_prop_assignee_pgposition, 400, 600);

    var lo1 = w1.attachLayout("2E");
    lo1.cells('a').hideHeader();
    lo1.cells('b').hideHeader();
    lo1.cells('b').setHeight(50);

    var tb1 = lo1.cells('a').attachToolbar();
    tb1.addInput('id_searcher', 0, '', 150);
    tb1.addText('id_searcher_label', 0, fmd_i18n_prop_pgsearch);

    var tree1 = lo1.cells('a').attachTree();
    tree1.setSkin(dhx_skin);
    tree1.setImagePath(dhtmlx.image_path + 'dhxtree_terrace/');

    var types = {};

    var ret = doGetAsyncJson(flvar.restCtx + '/fa/pg/allByTenantWithPos?timezoneOffset=' + new Date().getTimezoneOffset(),
        function (ret) {
            if (!ret) {
                lo1.progressOff();
                msgErr(fmd_i18n_msg_readfail);
                return;
            }
            var td = initOrgPosTreeData(ret);
            tree1.loadJSONObject(td, function () {
                tree1.openItem('ROOT')
            });
            lo1.progressOff();
        });

    function initOrgPosTreeData(ret) {
        var data1 = {};
        for (var i in ret) {
            data1[ret[i].id] = ret[i];
        }
        function findChildren(root, data) {
            if (data) {
                for (var i in data) {
                    if (data[i].parent == root.id) {
                        var child = {id: data[i].id, text: data[i].text};
                        types[data[i].id] = data[i].type;
                        if (data[i].type == 'POS') {
                            child.im0 = 'orgPos.png';
                            child.im1 = 'orgPos.png';
                            child.im2 = 'orgPos.png';
                        } else if (data[i].type == 'PG') {
                            child.im0 = 'orgDept.png';
                            child.im1 = 'orgDept.png';
                            child.im2 = 'orgDept.png';
                        }
                        delete data[i];
                        findChildren(child, data);
                        root.item = root.item || [];
                        root.item.push(child);
                    }
                }
            }
        }

        var root = {
            id: 0,
            text: '',
            item: [{id: 'ROOT', text: fmd_i18n_prop_allpg, im0: 'orgDept.png', im1: 'orgDept.png', im2: 'orgDept.png'}]
        };
        findChildren(root.item[0], data1);
        //console.log(JSON.stringify(root));
        return root;
    }

    var str2 = [
        {
            type: "block",
            name: "form_block_1",
            offsetLeft: (dhx_skin == "dhx_web" ? "133" : "137"),
            offsetTop: "0",
            list: [
                {type: "button", name: "fb_ok", value: fmd_i18n_b_ok, inputTop: 0}
            ]
        }
    ];
    var fm2 = lo1.cells('b').attachForm(str2);

    function returnVal(itemId) {
        var ids = itemId.split("_");
        var newv = {};
        newv.groupId = ids[0];
        newv.groupName = tree1.getItemText(ids[0]);
        newv.posId = ids[1];
        newv.posName = tree1.getItemText(itemId);
        newv.displayValue = newv.groupName + ' - ' + newv.posName;
        fmdc.grid_prop.cells(rId, cId).setValue(newv, true);
        w1.close();
    }

    tree1.attachEvent('onDblClick', function (itemId) {
        if (types[itemId] == 'POS') {
            returnVal(itemId);
        }
    });

    tb1.attachEvent('onEnter', function (itemId, value) {
        if (itemId == 'id_searcher' && $.trim(value)) {
            tree1.findItem($.trim(value), 0, 0);
        }
    });

    fm2.attachEvent("onButtonClick", function (btid) {
        if (btid == 'fb_ok') {
            var itemId = tree1.getSelectedItemId();
            if (!itemId || types[itemId] != 'POS') {
                msg(fmd_i18n_msg_plsselpos);
                return;
            }
            returnVal(itemId);
        }
    });


};

//解析表单变量
fldmeta_prop.func.UserTask.parseModelToInputOutput = function (fd1) {
    var mds = fd1.version.formdata.models;
    var input = {};
    for (var md1 in mds) {
        if (mds[md1].purpose == '0') {
            input[md1] = {"desc": mds[md1].bodesc, "children": {}};
            for (var at1 in mds[md1].attrs) {
                input[md1].children[at1] = {"type": mds[md1].attrs[at1].type, "desc": mds[md1].attrs[at1]['desc_'+flvar.lang]};
            }
        }
    }
    if (MyUtilJs.isEmpty(input)) {
        if (!MyUtilJs.isEmpty(mds)) return input;//only has bo for sub-table
        return null;
    } else {
        return {"input": input, "output": input};
    }
};

//来自表单变量
fldmeta_prop.func.UserTask.selectFormvar = function (rId, cId) {

    var form1 = fmdc.grid_prop.cells("formBinding", fldmeta_prop.gridconf.idx.value).getValue();
    //console.log(form1);
    if (!MyUtilJs.isEmpty(form1)) {
        doPostAsyncJson(flvar.fmdCtx + "/rest/fmd/getVersion", {"formid": form1.formid, "versionid": form1.versionid},
            function (ret) {
                //console.log(ret);
                var r1 = fldmeta_prop.func.UserTask.parseModelToInputOutput(ret);
                if (!r1) {
                    msg(fmd_i18n_msg_invalidmodelinform);
                } else if (MyUtilJs.isEmpty(r1)) {
                    msg(fmd_i18n_msg_nomainmodelinform);
                } else {
                    utp_callSelectFormvar(rId, cId, r1);
                }
            }
        );
    } else {
        msg(fmd_i18n_msg_plsselformver);
    }

    function utp_callSelectFormvar(rId, cId, r1) {
        var w1 = fm_createCenterWindow('wid_selectFormvar', fmd_i18n_prop_processvars, 400, 600);

        var lo1 = w1.attachLayout("2E");
        lo1.cells('a').hideHeader();
        lo1.cells('b').hideHeader();
        lo1.cells('b').setHeight(50);

        var str2 = [
            {
                type: "block",
                name: "form_block_1",
                offsetLeft: (dhx_skin == "dhx_web" ? "130" : "140"),
                offsetTop: "0",
                list: [
                    {type: "button", name: "fb_ok", value: fmd_i18n_b_ok, inputTop: 0}
                ]
            }
        ];
        var fm2 = lo1.cells('b').attachForm(str2);

        //grid
        var ragrid = lo1.cells('a').attachGrid();
        ragrid.setHeader([fmd_i18n_prop_formvar,
                fmd_i18n_prop_type,
                fmd_i18n_prop_desc],
            null,
            ["text-align:center;",
                "text-align:center;",
                "text-align:center;"]);
        fldmeta_prop.gridconf.treeIconPath && ragrid.setIconPath(fldmeta_prop.gridconf.treeIconPath);
        fldmeta_prop.gridconf.treeImagePath && ragrid.setImagePath(fldmeta_prop.gridconf.treeImagePath);
        fldmeta_prop.gridconf.extIconPath && (ragrid.extIconPath = fldmeta_prop.gridconf.extIconPath);
        ragrid.setInitWidths("170,60,110");
        ragrid.setColumnIds("VARNAME,VARTYPE,VARDESC");
        ragrid.setColTypes("tree,coro,ro");
        ragrid.setColSorting("na,na,na");
        ragrid.setColAlign("left,left,left");
        ragrid.setColumnsVisibility("false,false,false");
        ragrid.setEditable(false);
        ragrid.setLang(flvar.lang);
        ragrid.enableAlterCss("grid_even_row_white", "grid_odd_row_white");
        ragrid.init();

        ragrid.attachEvent("onRowDblClicked", function (rid) {
            if (!ragrid.getRowAttribute(rid, "isParam")) {
                msg(fmd_i18n_msg_plsselformvar);
                return;
            }
            if ('string' != ragrid.cells(rid, 1).getValue()) {
                msg(fmd_i18n_msg_pvmuststring);
                return;
            }
            var pvar = ragrid.cells(ragrid.getRowAttribute(rid, "rootId"), 0).getValue();
            var pvardesc = ragrid.cells(ragrid.getRowAttribute(rid, "rootId"), 2).getValue();
            var newval = {
                "varname": ragrid.cells(rid, 0).getValue(),
                "parentvarname": pvar,
                "parentvardesc": pvardesc,
                "vardesc": ragrid.cells(rid, 2).getValue(),
                "displayValue": pvar + "." + ragrid.cells(rid, 0).getValue() + "(" + ragrid.cells(rid, 2).getValue() + ")"
            };
            fmdc.grid_prop.cells(rId, cId).setValue(newval, true);	//第二个参数必须为true，触发事件
            w1.close();
        });

        //load existing vars
        if (r1) {
            function utp_loadActivityVars(rootId, avlist) {
                if (avlist) {
                    var count = 1;
                    for (id in avlist) {
                        var rid = rootId + "_" + count++;
                        ragrid.addRow(rid, [id, avlist[id].type, avlist[id].desc], null, rootId);
                        if (avlist[id].type) {
                            ragrid.grid_bindCombo(rid, 1,
                                fmd_i18n_prop_processvar_vals,
                                {"comboSize": 10, "comboWidth": 100},
                                avlist[id].type);
                            //set isParam
                            ragrid.setRowAttribute(rid, "isParam", true);
                            ragrid.setRowAttribute(rid, "rootId", rootId);
                            ragrid.cells(rid, 0).setImage(fmdc.grid_prop.extIconPath + "param.png");
                        } else if (avlist[id].children) {
                            ragrid.cells(rid, 0).setImage(fmdc.grid_prop.extIconPath + "module.png");
                            utp_loadActivityVars(rid, avlist[id].children);
                        }
                    }
                }
            }

            utp_loadActivityVars(0, r1.input);
            ragrid.expandAll();
        }

        fm2.attachEvent("onButtonClick", function (btid) {
            if (btid == 'fb_ok') {
                var rid = ragrid.getSelectedRowId();
                if (!rid) {
                    msg(fmd_i18n_prop_msg_plsselline);
                    return;
                }
                if (!ragrid.getRowAttribute(rid, "isParam")) {
                    msg(fmd_i18n_msg_plsselformvar);
                    return;
                }
                if ('string' != ragrid.cells(rid, 1).getValue()) {
                    msg(fmd_i18n_msg_pvmuststring);
                    return;
                }
                var pvar = ragrid.cells(ragrid.getRowAttribute(rid, "rootId"), 0).getValue();
                var pvardesc = ragrid.cells(ragrid.getRowAttribute(rid, "rootId"), 2).getValue();
                var newval = {
                    "varname": ragrid.cells(rid, 0).getValue(),
                    "parentvarname": pvar,
                    "parentvardesc": pvardesc,
                    "vardesc": ragrid.cells(rid, 2).getValue(),
                    "displayValue": pvar + "." + ragrid.cells(rid, 0).getValue() + "(" + ragrid.cells(rid, 2).getValue() + ")"
                };
                fmdc.grid_prop.cells(rId, cId).setValue(newval, true);	//第二个参数必须为true，触发事件
                w1.close();
            }
        });
    }
}

//来自流程变量
fldmeta_prop.func.UserTask.selectProcessvar = function (rId, cId) {
    var w1 = fm_createCenterWindow('wid_selectProcessvar', fmd_i18n_prop_processvars, 400, 600);

    var lo1 = w1.attachLayout("2E");
    lo1.cells('a').hideHeader();
    lo1.cells('b').hideHeader();
    lo1.cells('b').setHeight(50);

    var str2 = [
        {
            type: "block",
            name: "form_block_1",
            offsetLeft: (dhx_skin == "dhx_web" ? "130" : "140"),
            offsetTop: "0",
            list: [
                {type: "button", name: "fb_ok", value: fmd_i18n_b_ok, inputTop: 0}
            ]
        }
    ];
    var fm2 = lo1.cells('b').attachForm(str2);

    //grid
    var ragrid = lo1.cells('a').attachGrid();
    ragrid.setHeader([fmd_i18n_prop_variablename,
            fmd_i18n_prop_type,
            fmd_i18n_prop_allowin,
            fmd_i18n_prop_allowout,
            fmd_i18n_prop_desc],
        null,
        ["text-align:center;",
            "text-align:center;",
            "text-align:center;",
            "text-align:center;",
            "text-align:center;"]);
    ragrid.setInitWidths("80,60,60,60,*");
    ragrid.setColumnIds("VARNAME,VARTYPE,ALLOWIN,ALLOWOUT,VARDESC");
    ragrid.setColTypes("ro,coro,ch,ch,ro");
    ragrid.setColSorting("str,str,int,int,na");
    ragrid.setColAlign("left,left,center,center,left");
    ragrid.setColumnsVisibility("false,false,true,true,false");
    ragrid.setEditable(false);
    ragrid.setLang(flvar.lang);
    ragrid.enableAlterCss("", "");
    ragrid.init();

    ragrid.attachEvent("onRowDblClicked", function (rid) {
        if ('string' != ragrid.cells(rid, 1).getValue()) {
            msg(fmd_i18n_msg_pvmuststring);
            return;
        }
        var newval = {
            "varname": ragrid.cells(rid, 0).getValue(),
            "vardesc": ragrid.cells(rid, 4).getValue(),
            "displayValue": ragrid.cells(rid, 0).getValue() + "(" + ragrid.cells(rid, 4).getValue() + ")"
        };
        fmdc.grid_prop.cells(rId, cId).setValue(newval, true);	//第二个参数必须为true，触发事件
        w1.close();
    });

    //load existing process vars
    if (fl.curflow.bpmnConfig.processSettings.variables) {
        var count = 1;
        for (id in fl.curflow.bpmnConfig.processSettings.variables) {
            var rid = count++;
            ragrid.addRow(rid, [id, fl.curflow.bpmnConfig.processSettings.variables[id].type,
                fl.curflow.bpmnConfig.processSettings.variables[id].allowin,
                fl.curflow.bpmnConfig.processSettings.variables[id].allowout,
                fl.curflow.bpmnConfig.processSettings.variables[id].desc]);
            ragrid.grid_bindCombo(rid, 1,
                fmd_i18n_prop_processvar_vals,
                {"comboSize": 10, "comboWidth": 100},
                fl.curflow.bpmnConfig.processSettings.variables[id].type);
        }
    }

    fm2.attachEvent("onButtonClick", function (btid) {
        if (btid == 'fb_ok') {
            var rid = ragrid.getSelectedRowId();
            if (!rid) {
                msg(fmd_i18n_prop_msg_plsselline);
                return;
            }
            if ('string' != ragrid.cells(rid, 1).getValue()) {
                msg(fmd_i18n_msg_pvmuststring);
                return;
            }
            var newval = {
                "varname": ragrid.cells(rid, 0).getValue(),
                "vardesc": ragrid.cells(rid, 4).getValue(),
                "displayValue": ragrid.cells(rid, 0).getValue() + "(" + ragrid.cells(rid, 4).getValue() + ")"
            };
            fmdc.grid_prop.cells(rId, cId).setValue(newval, true);	//第二个参数必须为true，触发事件
            w1.close();
        }
    });
}

//选择岗位-不在特定部门或工作组
fldmeta_prop.func.UserTask.selectRelationPosition = function (rId, cId) {
    var w1 = fm_createCenterWindow('wid_selectPosition', fmd_i18n_prop_selposition, 600, 600);
    var bom = {};

    var lo1 = w1.attachLayout("2E");
    lo1.cells('a').hideHeader();
    lo1.cells('b').hideHeader();
    lo1.cells('b').setHeight(50);
    bom.stb = lo1.cells('a').attachStatusBar();
    bom.stb.setText("<div id='id_selectPosition_paging_stb1'></div>");

    var str2 = [
        {
            type: "block",
            name: "form_block_1",
            offsetLeft: (dhx_skin == "dhx_web" ? "233" : "237"),
            offsetTop: "0",
            list: [
                {type: "button", name: "fb_ok", value: fmd_i18n_b_ok, inputTop: 0}
            ]
        }
    ];
    var fm2 = lo1.cells('b').attachForm(str2);

    //grid
    var ragrid = lo1.cells('a').attachGrid();
    ragrid.setHeader([fmd_i18n_order,
            "POS_ID",
            fmd_i18n_prop_selposition,
            fmd_i18n_prop_description],
        null,
        ["text-align:center;",
            "text-align:center;",
            "text-align:center;",
            "text-align:center;"]);
    ragrid.attachHeader("#rspan,&nbsp;," +
        "<input id='sr_boname' type='text' style='width:90%'/>," +
        "<input id='sr_bodesc' type='text' style='width:90%'/>");
    ragrid.setInitWidths("60,60,200,280");
    ragrid.setColumnIds("NO,POS_ID,POS_NAME,POS_DESC");
    ragrid.setColTypes("ro,ro,ro,ro");
    ragrid.setColSorting("int,na,str,str");
    ragrid.setColumnsVisibility("false,true,false,false");
    ragrid.setColAlign("center,left,left,left");
    ragrid.setEditable(false);
    ragrid.setLang(flvar.lang);

    //paging
    ragrid.setPagingWTMode(true, true, true, [10, 20, 50, 100]);
    ragrid.enablePaging(true, 10, 5, 'id_selectPosition_paging_stb1');
    ragrid.setPagingSkin("toolbar", dhx_skin);

    //default ordering
    ragrid.grid_setOrderColumns([{"CREATE_TIME": "DESC"}]);

    ragrid.init();

    ragrid.attachEvent("onPageChanged", function (ind, fInd, lInd) {
        bom_toPage(fInd + 1, lInd);
    });

    //header click event
    ragrid.attachEvent("onHeaderClick", grid_onHeaderClick);

    ragrid.attachEvent("onRowDblClicked", function (rid) {
        var newval = {
            "posId": ragrid.cells(rid, 1).getValue(),
            "posName": ragrid.cells(rid, 2).getValue()
        };
        fmdc.grid_prop.cells(rId, cId).setValue(newval, true);	//第二个参数必须为true，触发事件
        w1.close();
    });

    fm2.attachEvent("onButtonClick", function (btid) {
        if (btid == 'fb_ok') {
            var rid = ragrid.getSelectedRowId();
            if (!rid) {
                msg(fmd_i18n_prop_msg_plsselline);
                return;
            }
            var newval = {
                "posId": ragrid.cells(rid, 1).getValue(),
                "posName": ragrid.cells(rid, 2).getValue()
            };
            fmdc.grid_prop.cells(rId, cId).setValue(newval, true);	//第二个参数必须为true，触发事件
            w1.close();
        }
    });

    //bind searcher event
    //disable onclick order by function for this header
    var trsr_boname = $("#sr_boname").parents('tr:first');
    trsr_boname.find('td').bind('click', bom_stopEvent);
    trsr_boname.find('td').bind('mouseover', bom_stopEvent);
    $("#sr_boname").bind('keypress', bom_enterQuery);
    $("#sr_bodesc").bind('keypress', bom_enterQuery);

    //query
    bom_toPage(1, 10);

    //call query bo
    function bom_enterQuery(e) {
        if (e.keyCode == 13) {
            bom.boquery_boname = $.trim($("#sr_boname").val());
            bom.boquery_bodesc = $.trim($("#sr_bodesc").val());
            bom_toPage(1, 10);
        }
    }

    //query bo
    function bom_toPage(fromRow, toRow) {
        lo1.progressOn();
        var p = {
            "queryParams": {}, "fromRow": fromRow, "toRow": toRow, "timezoneOffset": new Date().getTimezoneOffset(),
            "ordercolumns": JSON.stringify(ragrid._grid_ordercolumns)
        };
        bom.boquery_boname && (p.queryParams.posName = bom.boquery_boname);
        bom.boquery_bodesc && (p.queryParams.posDesc = bom.boquery_bodesc);
        p.queryParams = JSON.stringify(p.queryParams);
        var ret = doPostAsyncJson(flvar.restCtx + '/fa/pos/queryDhx', p, function (ret) {
            if (!ret) {
                lo1.progressOff();
                msgErr(fmd_i18n_msg_readfail);
                return;
            }
            ragrid.clearAllInPaging();
            ragrid.parse(ret, "json");
            lo1.progressOff();
        });
    }

    //stop event propagation
    function bom_stopEvent(e) {
        if (e && e.stopPropagation != undefined) {
            e.stopPropagation();
        } else if (window.event) {
            window.event.cancelBubble = true;
        }
        return false;
    }
};

//查找所有前序环节
fldmeta_prop.func.UserTask.getPreActivityNames = function (elemid, diagramJson) {
    //get previous activities
    var preAcs = {};
    //迭代sourceRef
    //TODO 处理死循环
    function appendPreActivityNames(acs) {
        for (var i in acs) {
            var result = JSONSelect.match(':has(:root > .targetRef:val("' + acs[i] + '")) > .sourceRef', diagramJson);
            //console.debug("acs[i] pres="+JSON.stringify(result));
            if (result && result.length) {
                for (var j in result) {
                    if (preAcs[result[j]] || result[j] == elemid) {	//如果回溯路径到已存在的环节或当前检测的环节则停止
                        break;
                    }
                    //是否子流程
                    if (result[j].indexOf("SubProcess_") >= 0) {
                        var elem1 = getIORegistedElem(result[j]);
                        var subobj = {
                            "i18nname-zh": fl.curflow.bpmnConfig[result[j]]["i18nname-zh"] || fmd_i18n_prop_untitled,
                            "collapsed": elem1.collapsed
                        };
                        if (elem1.collapsed) {//链接子流程
                            if (fl.curflow.bpmnConfig[elem1.id].processRef && fl.curflow.bpmnConfig[elem1.id].processRef.id) {//已选择引用流程
                                var versionid = null;	//TODO 引用流程版本问题
                                var flow = doGetSyncJson(flvar.bpmeRest + "/flow/" + fl.curflow.bpmnConfig[elem1.id].processRef.id + "/versionWithBpd/" + (versionid != null ? versionid : "current"));
                                var bc = JSON.parse(flow.version.bpmnConfig);
                                var children = {};	//子流程上的环节
                                for (var c in bc) {
                                    if (c.indexOf("Task_") >= 0) {
                                        children[c] = {"i18nname-zh": bc[c]["i18nname-zh"]};
                                        //记录席位任务的视图id -因为是在不同流程中，这里要在验证之前提前记录提高性能
                                        if ('UserTask' == bc[c].i18ntype && 'roletask' == bc[c].userTaskType
                                            && bc[c].roleActivity && bc[c].roleActivity.compid) {
                                            children[c].roleViewId = bc[c].roleActivity.compid;
                                        }
                                    }
                                }
                                subobj.id = fl.curflow.bpmnConfig[elem1.id].processRef.id;
                                subobj.children = children;
                            }
                            //添加到结果
                            preAcs[result[j]] = {};
                        } else {//内嵌子流程
                            var children = {};	//子流程上的环节
                            for (var c in elem1.children) {
                                //因为内嵌子流程中不能再内嵌其他子流程，这里仅需要记录各种任务环节即可
                                if (typeof(elem1.children[c]) == "object" && elem1.children[c].id && elem1.children[c].id.indexOf("Task_") >= 0) {
                                    children[elem1.children[c].id] = {"i18nname-zh": fl.curflow.bpmnConfig[elem1.children[c].id]["i18nname-zh"] || fmd_i18n_prop_untitled};
                                    //记录席位任务的视图id
                                    if ('UserTask' == fl.curflow.bpmnConfig[elem1.children[c].id].i18ntype
                                        && 'roletask' == fl.curflow.bpmnConfig[elem1.children[c].id].userTaskType
                                        && fl.curflow.bpmnConfig[elem1.children[c].id].roleActivity
                                        && fl.curflow.bpmnConfig[elem1.children[c].id].roleActivity.compid) {
                                        children[elem1.children[c].id].roleViewId = fl.curflow.bpmnConfig[elem1.children[c].id].roleActivity.compid;
                                    }
                                }
                            }
                            subobj.children = children;
                        }
                        //添加到结果
                        preAcs[result[j]] = subobj;
                    } else {
                        //主流程上的环节不区分环节类型统一加入列表
                        preAcs[result[j]] = {"i18nname-zh": fl.curflow.bpmnConfig[result[j]]["i18nname-zh"] || fmd_i18n_prop_untitled};
                        //记录席位任务的视图id
                        if ('UserTask' == fl.curflow.bpmnConfig[result[j]].i18ntype
                            && 'roletask' == fl.curflow.bpmnConfig[result[j]].userTaskType
                            && fl.curflow.bpmnConfig[result[j]].roleActivity
                            && fl.curflow.bpmnConfig[result[j]].roleActivity.compid) {
                            preAcs[result[j]].roleViewId = fl.curflow.bpmnConfig[result[j]].roleActivity.compid;
                        }
                    }
                    //迭代
                    appendPreActivityNames(result);
                }
            }
        }
    }

    var checkElems = [elemid];
    //如果是内嵌子流程中的任务，需要增加检测作为该任务父节点的子流程节点
    var el1 = getIORegistedElem(elemid);
    if (typeof(el1) == "object"
        && el1.businessObject.$parent
        && el1.businessObject.$parent.id
        && el1.businessObject.$parent.id.indexOf("SubProcess_") >= 0) {
        checkElems.push(el1.businessObject.$parent.id);
    }
    //开始查找
    if (diagramJson) {
        appendPreActivityNames(checkElems);
    } else {
        bi.saveDiagram(function (err, xml) {
            diagramJson = xml2json.fromStr(xml);
            appendPreActivityNames(checkElems);
            //console.debug(JSON.stringify(preAcs));
        });
    }
    //console.log(elemid+" preAcs result="+JSON.stringify(preAcs));
    return preAcs;
};

//判断一个环节是否为另一环节的前序环节
fldmeta_prop.func.UserTask.isPreActivity = function (post, pre, diagramJson) {
    var pres = fldmeta_prop.func.UserTask.getPreActivityNames(post, diagramJson);
    return pres[pre] != undefined;
};

//选择可以驳回环节
fldmeta_prop.func.UserTask.selectRejectPath = function (rId, cId) {

    //check previous activities
    var preAcs = fldmeta_prop.func.UserTask.getPreActivityNames(fl.curComp.id);

    var gd = {"rows": []};
    /*$("g[data-element-id*='Task_']").each(function(index,element){
     var elemid = $(element).attr("data-element-id");
     gd.rows.push({"id":++count, "data":[1, elemid, fldmeta_prop.func.getCompInnerName(elemid) || fmd_i18n_prop_untitled]});
     });*/
    for (var elemid in preAcs) {
        if (elemid.indexOf("Task_") >= 0) {
            gd.rows.push({
                "id": elemid,
                "data": [0, elemid, fldmeta_prop.func.getCompInnerName(elemid) || fmd_i18n_prop_untitled]
            });
        } else if (preAcs[elemid].children) {
            if (preAcs[elemid].collapsed) {//链接子流程
                //do nothing
            } else {//内嵌子流程
                for (var c in preAcs[elemid].children) {
                    gd.rows.push({
                        "id": c,
                        "data": [0, c, fldmeta_prop.func.getCompInnerName(c) || fmd_i18n_prop_untitled]
                    });
                }
            }
        }
    }
    //console.debug(JSON.stringify(gd));
    if (gd.rows.length == 0) {
        msg(fmd_i18n_msg_noPreActivities);
        return;
    }

    var w1 = fm_createCenterWindow('wid_selectRejectPath', fmd_i18n_prop_rejectPathSelect, 400, 600);
    var lo1 = w1.attachLayout("2E");
    lo1.cells('a').hideHeader();
    lo1.cells('b').hideHeader();
    lo1.cells('b').setHeight(50);

    //grid
    var ragrid = lo1.cells('a').attachGrid();
    ragrid.setHeader([fmd_i18n_select,
            fmd_i18n_prop_id,
            fmd_i18n_prop_activityname],
        null,
        ["text-align:center;",
            "text-align:center;",
            "text-align:center;"]);
    ragrid.setInitWidths("60,120,*");
    ragrid.setColTypes("ch,ro,ro");
    ragrid.setColSorting("int,str,str");
    ragrid.setColumnsVisibility("false,false,false");
    ragrid.setColAlign("center,left,left");
    ragrid.setEditable(true);
    ragrid.setLang(flvar.lang);
    ragrid.init();
    ragrid.parse(gd, "json");

    //set existing values
    var oldval = fl.curflow.bpmnConfig[fl.curComp.id][rId];
    if (oldval && oldval.length > 0) {
        for (var i in oldval) {
            ragrid.cells(oldval[i].activityId, 0).setValue(1);
        }
    }

    var str2 = [{
        type: "block",
        name: "form_block_1",
        offsetLeft: (dhx_skin == "dhx_web" ? "130" : "140"),
        offsetTop: "0",
        list: [
            {type: "button", name: "fb_ok", value: fmd_i18n_b_ok, inputTop: 0}]
    }];
    var fm2 = lo1.cells('b').attachForm(str2);
    fm2.attachEvent("onButtonClick", function (btid) {
        if (btid == 'fb_ok') {
            var rids = ragrid.getCheckedRows(0).split(",");
            if (!rids || rids.length == 0 || "" == rids[0]) {
                msg(fmd_i18n_prop_msg_plsselmulti);
                return;
            }
            var newval = [];
            for (var i = 0; i < rids.length; i++) {
                newval.push({
                    "activityId": ragrid.cells(rids[i], 1).getValue(),
                    "activityName": ragrid.cells(rids[i], 2).getValue()
                });
            }
            fmdc.grid_prop.cells(rId, cId).setValue(newval, true);	//第二个参数必须为true，触发事件
            /*if (fl.curComp && fl.curComp.id && fl.curflow.bpmnConfig && fl.curflow.bpmnConfig[fl.curComp.id]) {
             fl.curflow.bpmnConfig[fl.curComp.id][rId] = newval;
             }*/
            w1.close();
        }
    });
};

//选择一个前序环节
fldmeta_prop.func.UserTask.selectPreActivity = function (rId, cId) {

    //check previous activities
    var preAcs = fldmeta_prop.func.UserTask.getPreActivityNames(fl.curComp.id);

    var gd = {"rows": []};
    for (var elemid in preAcs) {
        if (elemid.indexOf("Task_") >= 0) {
            gd.rows.push({
                "id": elemid,
                "data": [0, elemid, fldmeta_prop.func.getCompInnerName(elemid) || fmd_i18n_prop_untitled]
            });
        } else if (preAcs[elemid].children) {
            if (preAcs[elemid].collapsed) {//链接子流程
                //do nothing
            } else {//内嵌子流程
                for (var c in preAcs[elemid].children) {
                    gd.rows.push({
                        "id": c,
                        "data": [0, c, fldmeta_prop.func.getCompInnerName(c) || fmd_i18n_prop_untitled]
                    });
                }
            }
        }
    }
    if (gd.rows.length == 0) {
        msg(fmd_i18n_msg_noPreActivities);
        return;
    }

    var w1 = fm_createCenterWindow('wid_selectPreActivity', fmd_i18n_prop_rejectPathSelect, 400, 600);
    var lo1 = w1.attachLayout("2E");
    lo1.cells('a').hideHeader();
    lo1.cells('b').hideHeader();
    lo1.cells('b').setHeight(50);

    //grid
    var ragrid = lo1.cells('a').attachGrid();
    ragrid.setHeader([fmd_i18n_select,
            fmd_i18n_prop_id,
            fmd_i18n_prop_activityname],
        null,
        ["text-align:center;",
            "text-align:center;",
            "text-align:center;"]);
    ragrid.setInitWidths("60,120,*");
    ragrid.setColTypes("ra,ro,ro");
    ragrid.setColSorting("int,str,str");
    ragrid.setColumnsVisibility("false,false,false");
    ragrid.setColAlign("center,left,left");
    ragrid.setEditable(true);
    ragrid.setLang(flvar.lang);
    ragrid.setColumnsVisibility("true,false,false");
    ragrid.init();
    ragrid.parse(gd, "json");

    ragrid.attachEvent("onRowDblClicked", function (rid) {
        var newval = {
            "activityId": ragrid.cells(rid, 1).getValue(),
            "activityName": ragrid.cells(rid, 2).getValue()
        };
        fmdc.grid_prop.cells(rId, cId).setValue(newval, true);	//第二个参数必须为true，触发事件
        w1.close();
    });

    var str2 = [{
        type: "block",
        name: "form_block_1",
        offsetLeft: (dhx_skin == "dhx_web" ? "130" : "140"),
        offsetTop: "0",
        list: [
            {type: "button", name: "fb_ok", value: fmd_i18n_b_ok, inputTop: 0}]
    }];
    var fm2 = lo1.cells('b').attachForm(str2);
    fm2.attachEvent("onButtonClick", function (btid) {
        if (btid == 'fb_ok') {
            var rid = ragrid.getSelectedRowId();
            if (!rid) {
                msg(fmd_i18n_msg_sel);
                return;
            }
            var newval = {
                "activityId": ragrid.cells(rid, 1).getValue(),
                "activityName": ragrid.cells(rid, 2).getValue()
            };
            fmdc.grid_prop.cells(rId, cId).setValue(newval, true);	//第二个参数必须为true，触发事件
            w1.close();
        }
    });
};

//select summary data
fldmeta_prop.func.selectDataSummary = function (rId, cId) {
    //检查表单是否选择
    var bform = fmdc.grid_prop.cells("formBinding", fldmeta_prop.gridconf.idx.value).getValue();
    if (MyUtilJs.isEmpty(bform)) {
        msg(fmd_i18n_msg_plsselformver);return;
    }
    doPostAsyncJson(flvar.fmdCtx + "/rest/fmd/getVersion", {
              "formid": bform.formid,
              "versionid": bform.versionid
           },
           showSelectSummary
    );
    function showSelectSummary(ret) {
        if (!ret) return;
        var models = ret.version.formdata.models;
        if (MyUtilJs.isEmpty(models)) {
            msg(fmd_i18n_msg_formnomodel);return;
        }
        //console.log(fm1.version.formdata.models);

        var w1 = fm_createCenterWindow('wid_selectSummay', fmd_i18n_prop_dataSummary, 600, 600);

        var lo1 = w1.attachLayout("2E");
        lo1.cells('a').hideHeader();
        lo1.cells('b').hideHeader();
        lo1.cells('b').setHeight(50);

        var str2 = [
            {
                type: "block",
                name: "form_block_1",
                offsetLeft: (dhx_skin == "dhx_web" ? "234" : "237"),
                offsetTop: "0",
                list: [
                    {type: "button", name: "fb_ok", value: fmd_i18n_b_ok, inputTop: 0}
                ]
            }
        ];
        var fm1 = lo1.cells('b').attachForm(str2);
        fm1.attachEvent("onButtonClick", function(btid) {
            if (btid=='fb_ok') {
                utp_return();
            }
        });

        var grid1 = lo1.cells('a').attachGrid();
        grid1.setHeader([fmd_i18n_prop_variablename,
                fmd_i18n_prop_desc,
                fmd_i18n_prop_type,
                fmd_i18n_b_sel,
                "IS_MODEL"],
            null,
            ["text-align:center;",
                "text-align:center;",
                "text-align:center;",
                "text-align:center;",
                "text-align:center;"]);
        fldmeta_prop.gridconf.treeIconPath && grid1.setIconPath(fldmeta_prop.gridconf.treeIconPath);
        fldmeta_prop.gridconf.treeImagePath && grid1.setImagePath(fldmeta_prop.gridconf.treeImagePath);
        fldmeta_prop.gridconf.extIconPath && (grid1.extIconPath = fldmeta_prop.gridconf.extIconPath);
        grid1.setInitWidths("180,180,130,60,60");
        grid1.setColumnIds("NAME,DESC,TYPE,SEL,IS_MODEL");
        grid1.setColTypes("tree,ro,ro,ch,ro");
        grid1.setColSorting("na,na,na,na,na");
        grid1.setColAlign("left,left,center,center,center");
        grid1.setColumnsVisibility("false,false,false,false,true");
        grid1.setEditable(true);
        grid1.setLang(flvar.lang);
        grid1.enableAlterCss("grid_even_row_white","grid_odd_row_white");
        grid1.init();

        grid1.attachEvent('onEditCell', function (stage,rrid,ccid,nv) {
            if ('ch'==this.getColType(ccid) && stage==1) {
                //处理checkbox类型的属性值被用户修改时
                nv = this.cells(rrid,ccid).getValue();
                var isModel = this.cells(rrid, 4).getValue();
                if (isModel=='1') { //处理模型下所有字段
                    var subs = this.getAllSubItems(rrid);
                    if (subs && subs.length) {
                        var subs = subs.split(",");
                        for (var i in subs) {
                            this.cells(subs[i], ccid).setValue(nv);
                        }
                    }
                }
            }
            return true;
        });

        //get existing selection
        var curVal = fmdc.grid_prop.cells(rId, fldmeta_prop.gridconf.idx.value).getValue() || {};

        //load by models & cols
        //console.log(models);
        for (var model in models) {
            if (models[model].purpose=='1') continue;   //跳过子表
            grid1.addRow(model, [model, models[model].bodesc, "", "", 1], null, null);
            grid1.cells(model, 0).setImage(fmdc.grid_prop.extIconPath+"module.png");
            for (var attr in models[model].attrs) {
                grid1.addRow(model+"."+attr, [attr, models[model].attrs[attr]["desc_"+flvar.lang], fmd_i18n_prop_processvar_valsenum[models[model].attrs[attr].type], curVal[model] && curVal[model][attr] ? "1" : "0", 0], null, model);
                grid1.cells(model+"."+attr, 0).setImage(fmdc.grid_prop.extIconPath+"param.png");
            }
        }
        grid1.expandAll();

        function utp_return() {
            var newval = {};
            var rn = grid1.getRowsNum();
            if (rn) {
                for (var i=0; i<rn; i++) {
                    var rrid = grid1.getRowId(i);
                    if ("1"!=grid1.cells(rrid, 4).getValue() && "1"==grid1.cells(rrid, 3).getValue()) {
                        var model = rrid.split(".")[0], attr = rrid.split(".")[1];
                        newval[model] = newval[model] || {};
                        newval[model][attr] = {'zh': models[model].attrs[attr].desc_zh, 'en': models[model].attrs[attr].desc_en};
                    }
                }
            }
            //console.log(newval);
            fmdc.grid_prop.cells(rId, cId).setValue(newval, true);
            w1.close();
        }
    }
}

//assignType
fldmeta_prop.func.UserTask.predefined["assignType"] = {
    "name": fmd_i18n_prop_assignType,
    "tooltip": fmd_i18n_prop_assignType,
    "img": "approvalType.png",
    "cellType": {
        "type": "coro",
        "options": fmd_i18n_prop_assignTypes
    },
    "value": {"default": "multiple"}/*,
     "conditional-sub" : {
     "multiple" : {
     "multiApprovalOrder" : {
     "name" : fmd_i18n_prop_multiApprovalOrder,
     "tooltip" : fmd_i18n_prop_multiApprovalOrder,
     "img" : "multiApprovalOrder.png",
     "cellType" : {
     "type" : "coro",
     "options" : fmd_i18n_prop_multiApprovalOrders
     },
     "value" : {"default":"parallel"}
     },
     "allowUnInvolve" : {
     "name" : fmd_i18n_prop_allowUnInvolve,
     "tooltip" : fmd_i18n_prop_allowUnInvolve,
     "img" : "allowUnInvolve.png",
     "cellType" : "ch",
     "value" : {"default":0}
     }
     }
     }*/
};


//new process remind
fldmeta_prop.func.UserTask.predefined["newTaskRemind"] = {
    "name": fmd_i18n_prop_newtaskremind,
    "img": "ring3.png",
    "tooltip": fmd_i18n_prop_newtaskremind,
    "cellType": "ch",
    "value": {"default": 0},
    "conditional-sub": {
        "1": {
            "newTaskRemindMethods": {
                "name": fmd_i18n_prop_remindmethods,
                "img": "ring3.png",
                "cellType": {
                    "type": "colist",
                    "config": {
                        "list": fmd_i18n_prop_newtaskremindmethods_vals
                    }
                },
                "value": {"default": "email"},
                "validatorFunc": function (elemid, value, prefix) {
                    if (null != fl.curflow.bpmnConfig[elemid].newTaskRemind && Number(fl.curflow.bpmnConfig[elemid].newTaskRemind) && !value) {
                        //return {"type":"error", "msg":fmd_i18n_msg_newtaskremindNoMethod};
                        fl_pushValidationErr(elemid, "newTaskRemindMethods", "error", prefix + fmd_i18n_msg_newtaskremindNoMethod);
                    }
                    return null;
                }
            }
        }
    }
};

//allow reject
fldmeta_prop.func.UserTask.predefined["allowReject"] = {
    "name": fmd_i18n_prop_allowReject,
    "img": "allowReject.png",
    "tooltip": fmd_i18n_prop_allowReject,
    "cellType": "ch",
    "value": {"default": 0},
    "conditional-sub": {
        "1": {
            "rejectPathSelect": {
                "name": fmd_i18n_prop_rejectPathSelect,
                "img": "rejectPathSelect.png",
                "asterisk": true,
                "cellType": {
                    "type": "btnex",
                    "config": {
                        "onclick": fldmeta_prop.func.UserTask.selectRejectPath
                    }
                },
                "value": {"default": null},
                "validatorFunc": function (elemid, value, prefix) {
                    if (null != fl.curflow.bpmnConfig[elemid].allowReject && Number(fl.curflow.bpmnConfig[elemid].allowReject) && (!value || MyUtilJs.isEmpty(value))) {
                        //return {"type":"error", "msg":fmd_i18n_msg_allowRejectNoPath};
                        fl_pushValidationErr(elemid, "rejectPathSelect", "error", prefix + fmd_i18n_msg_allowRejectNoPath);
                    }
                    return null;
                }
            }
        }
    }
};

//allow reject
fldmeta_prop.func.UserTask.predefined["isApprovalActivity"] = {
    "name": fmd_i18n_prop_isApprovalActivity,
    "img": "approvalType.png",
    "tooltip": fmd_i18n_tip_multiApprovalEvaluation,
    "cellType": "ch",
    "value": {"default": 0},
    "conditional-sub": {
        "1": {
            "multiApprovalEvaluation": {
                "name": fmd_i18n_prop_multiApprovalEvaluation,
                "tooltip": fmd_i18n_tip_multiApprovalEvaluation,
                "img": "multiApprovalEvaluation.png",
                "cellType": {
                    "type": "coro",
                    "options": fmd_i18n_prop_multiApprovalEvaluation_enum
                },
                "value": {"default": "all"},
                "conditional-sub": {
                    "number": {
                        "multiApprovalEvaluationNumber": {
                            "name": fmd_i18n_prop_multiApprovalEvaluationNumber,
                            "tooltip": fmd_i18n_tip_multiApprovalEvaluationNumber,
                            "img": "evaluationNumber.png",
                            "asterisk": true,
                            "cellType": {
                                "type": "jquispinner",
                                "config": {
                                    "min": 1
                                }
                            },
                            "value": {"default": "1"},
                            "validator": "ValidPositiveInteger",
                            "validatorFunc": function (elemid, value, prefix) {
                                if (Number(fl.curflow.bpmnConfig[elemid].isApprovalActivity) &&
                                    'multiple' == fl.curflow.bpmnConfig[elemid].assignType &&
                                    'number' == fl.curflow.bpmnConfig[elemid].multiApprovalEvaluation && !dhtmlxValidation.isValidPositiveInteger(value)) {
                                    //return {"type":"error", "msg":fmd_i18n_vld_failed + " " + fldmeta_prop.runtime_validators_i18n["ValidPositiveInteger"]};
                                    fl_pushValidationErr(elemid, "multiApprovalEvaluationNumber", "error", prefix + fmd_i18n_vld_failed + " " + fldmeta_prop.runtime_validators_i18n["ValidPositiveInteger"]);
                                }
                                return null;
                            }
                        }
                    },
                    "percent": {
                        "multiApprovalEvaluationPercent": {
                            "name": fmd_i18n_prop_multiApprovalEvaluationPercent,
                            "tooltip": fmd_i18n_tip_multiApprovalEvaluationPercent,
                            "img": "percent.png",
                            "asterisk": true,
                            "cellType": {
                                "type": "jquispinner",
                                "config": {
                                    "min": 1,
                                    "max": 99
                                }
                            },
                            "value": {"default": 50},
                            "validator": "ValidPercent",
                            "validatorFunc": function (elemid, value, prefix) {
                                if (Number(fl.curflow.bpmnConfig[elemid].isApprovalActivity) &&
                                    'multiple' == fl.curflow.bpmnConfig[elemid].assignType
                                    && 'percent' == fl.curflow.bpmnConfig[elemid].multiApprovalEvaluation
                                    && !dhtmlxValidation.isValidPercent(value)) {
                                    //return {"type":"error", "msg":fmd_i18n_vld_failed + " " + fldmeta_prop.runtime_validators_i18n["ValidPercent"]};
                                    fl_pushValidationErr(elemid, "multiApprovalEvaluationPercent", "error", prefix + fmd_i18n_vld_failed + " " + fldmeta_prop.runtime_validators_i18n["ValidPercent"]);
                                }
                                return null;
                            }
                        }
                    }
                }
            }
        }
    }
};

//allow involve others
fldmeta_prop.func.UserTask.predefined["allowInvolve"] = {
    "name": fmd_i18n_prop_allowInvolve,
    "img": "allowInvolve.png",
    "tooltip": fmd_i18n_prop_allowInvolve,
    "cellType": "ch",
    "value": {"default": 0},
    "conditional-sub": {
        "1": {
            "involveType": {
                "name": fmd_i18n_prop_involveType,
                "img": "allowInvolve.png",
                "cellType": {
                    "type": "coro",
                    "options": fmd_i18n_prop_involveType_enum
                },
                "value": {"default": "parallel"}
            }
        }
    }
};

//set data mapping 数据映射
fldmeta_prop.func.UserTask.predefined["dataMapping"] = {
    "name": fmd_i18n_prop_dataMapping,
    "img": "dataMapping.png",
    "tooltip": fmd_i18n_tooltip_dataMapping,
    "cellType": {
        "type": "btnex",
        "config": {
            "onclick": fldmeta_prop.func.callSetDataMapping
        }
    },
    "value": {"default": null},
    "validatorFunc": function (elemid, val, prefix) {
        //验证是异步的，必须返回后再弹出验证信息
        fldmeta_prop.func.getActivityVarsAndCheckValWithCallback(elemid, val, function (elemid, val, activityVars) {
            if (!activityVars) return;
            if (!val || MyUtilJs.isEmpty(val)) {
                /*if (!MyUtilJs.isEmpty(activityVars.input) || !MyUtilJs.isEmpty(activityVars.output)) {
                 fl_pushValidationErr(elemid, "dataMapping", "warning", prefix + fmd_i18n_msg_noDatamapping);
                 }*/
            } else {
                //检查映射的表单变量和流程变量是否有效
                for (var io in val) {
                    for (var fv in val[io]) {
                        //表单变量
                        var fva = fv.split("|");
                        var ioname = io == "input" ? fmd_i18n_title_dataMapping_input : fmd_i18n_title_dataMapping_output;
                        try {
                            var b1 = eval("activityVars[io][fva[0]].children[fva[1]]!=undefined");
                            if (!b1) fl_pushValidationErr(elemid, "dataMapping", "error", prefix +
                                ioname + fmd_i18n_msg_invalidbindingformvar + fva[0] + "." + fva[1] + fmd_i18n_msg_reconfigdm);
                        } catch (e) {
                            fl_pushValidationErr(elemid, "dataMapping", "error", prefix +
                                ioname + fmd_i18n_msg_invalidbindingformvar + fva[0] + "." + fva[1] + fmd_i18n_msg_reconfigdm);
                        }
                        //流程变量
                        if (!fldmeta_prop.func.isValidProcessVar(val[io][fv])) {
                            fl_pushValidationErr(elemid, "dataMapping", "error", prefix +
                                ioname + fmd_i18n_msg_invalidmappingpvar + val[io][fv]);
                        }
                    }
                }
                //检查是否有未映射的
                /*var missing = false;
                 if (!MyUtilJs.isEmpty(activityVars.input)) {
                 var in1 = val.input;
                 if (!in1) {
                 fl_pushValidationErr(elemid, "dataMapping", "warning", prefix + fmd_i18n_msg_noDatamapping);
                 missing = true;
                 } else {
                 var matchs1 = JSONSelect.match(":has(:root > .type)", activityVars.input);
                 //过滤prerequisite
                 var matchs = [];
                 for (var i in matchs1) {
                 !matchs1[i].path && (matchs.push(matchs1[i]));
                 }
                 //console.debug(matchs.length+"  >  "+MyUtilJs.getJsonKeyLength(in1));
                 if (matchs.length > MyUtilJs.getJsonKeyLength(in1)) {
                 fl_pushValidationErr(elemid, "dataMapping", "warning", prefix + fmd_i18n_msg_noDatamapping);
                 missing = true;
                 }
                 }
                 }
                 if (!missing && !MyUtilJs.isEmpty(activityVars.output)) {
                 var out1 = val.output;
                 if (!out1) {
                 fl_pushValidationErr(elemid, "dataMapping", "warning", prefix + fmd_i18n_msg_noDatamapping);
                 } else {
                 var matchs1 = JSONSelect.match(":has(:root > .type)", activityVars.output);
                 //过滤prerequisite
                 var matchs = [];
                 for (var i in matchs1) {
                 !matchs1[i].path && (matchs.push(matchs1[i]));
                 }
                 //console.debug(matchs.length+"  >  "+MyUtilJs.getJsonKeyLength(out1));
                 if (matchs.length > MyUtilJs.getJsonKeyLength(out1)) {
                 fl_pushValidationErr(elemid, "dataMapping", "warning", prefix + fmd_i18n_msg_noDatamapping);
                 }
                 }
                 }*/
            }
        });
    }
};

//readonly form binding for every task in pi view
fldmeta_prop.func.UserTask.predefined["viewFormBinding"] = {
    "name" : fmd_i18n_prop_viewFormBinding,
    "img" : "formBinding.png",
    "tooltip" : fmd_i18n_prop_viewFormBinding,
    "cellType" : {
        "type" : "btnex",
        "config" : {
            "displayValue" : "displayValue",
            "onclick" : fldmeta_prop.func.selectForm,
            "ishidebtn" : function(){return !fmdc.grid_prop.isEditor}
        }
    },
    "value" : {"default":null}
};

//summary data selecting
fldmeta_prop.func.UserTask.predefined["dataSummary"] = {
    "name": fmd_i18n_prop_dataSummary,
    "img": "summary.png",
    "tooltip": fmd_i18n_tooltip_dataSummary,
    "cellType": {
        "type": "btnex",
        "config": {
            "onclick": fldmeta_prop.func.selectDataSummary
        }
    },
    "value": {"default": null}
}

//form binding
fldmeta_prop.func.UserTask.predefined["formBinding"] = {
    "name": fmd_i18n_prop_formBinding,
    "img": "formBinding.png",
    "asterisk": true,
    "tooltip": fmd_i18n_prop_formBinding,
    "cellType": {
        "type": "btnex",
        "config": {
            "displayValue": "displayValue",
            "onclick": fldmeta_prop.func.selectForm,
            "ishidebtn": function () {
                return !fmdc.grid_prop.isEditor
            }
        }
    },
    "value": {"default": null},
    "validatorFunc": function (elemid, value, prefix) {
        if (MyUtilJs.isEmpty(value)) {
            fl_pushValidationErr(elemid, "formBinding", "error", prefix + fmd_i18n_vld_failed + " " + fmd_i18n_vld_notempty);
        } else if (!fl.curflow.otherConfig.validationData[elemid]["bindedFormModels"]) {
            fl_pushValidationErr(elemid, "formBinding", "error", prefix + fmd_i18n_vld_failed + " " +
                fmd_i18n_msg_invalidbindingform + value.formname + "，" + fmd_i18n_prop_version + ":" + value.versionname);
        } else if (MyUtilJs.isEmpty(fl.curflow.otherConfig.validationData[elemid]["bindedFormModels"])) {
            //{} means only has bo for sub-table
        }
    },
    "sub": {
        "dataMapping": fldmeta_prop.func.UserTask.predefined["dataMapping"],
        "dataSummary": fldmeta_prop.func.UserTask.predefined["dataSummary"],
        "viewFormBinding": fldmeta_prop.func.UserTask.predefined["viewFormBinding"]
    }
};

//on component added
fldmeta_prop.funcOnCompAdded.UserTask = function (elemid, elem) {

};

//on component removed
fldmeta_prop.funcOnCompRemoved.UserTask = function (elemid, elem) {

};

//on component changed
fldmeta_prop.funcOnCompChanged.UserTask = function (elemid, elem) {
    fl.curflow.bpmnConfig[elemid]["i18nname-zh"] = fldmeta_prop.func.getCompInnerName(elemid);
};

//on color change of UserTask
fldmeta_prop.func.UserTask.onDisplayStyle = function (elemid, rId, nv) {
    if (rId == "displayStyle_GradientColor0") {
        var grd = Snap("svg").select("#Gradient_" + elemid);
        grd && grd.remove();
        var c0 = nv;
        var c1 = fl.curflow.bpmnConfig[elemid]["displayStyle_GradientColor1"] || flstyle.elem.gradients.Task.b;
        var c2 = fl.curflow.bpmnConfig[elemid]["displayStyle_GradientColor2"] || flstyle.elem.gradients.Task.c;
        grd = Snap("svg").paper.gradient("L(0, 0, 100, 100)" + c0 + "-" + c1 + ":25-" + c2);
        grd.attr("id", "Gradient_" + elemid);
        Snap("g[data-element-id='" + elemid + "'] g.djs-visual rect").attr({"fill": "url(#Gradient_" + elemid + ")"});
    } else if (rId == "displayStyle_GradientColor1") {
        var grd = Snap("svg").select("#Gradient_" + elemid);
        grd && grd.remove();
        var c0 = fl.curflow.bpmnConfig[elemid]["displayStyle_GradientColor0"] || flstyle.elem.gradients.Task.a;
        var c1 = nv;
        var c2 = fl.curflow.bpmnConfig[elemid]["displayStyle_GradientColor2"] || flstyle.elem.gradients.Task.c;
        grd = Snap("svg").paper.gradient("L(0, 0, 100, 100)" + c0 + "-" + c1 + ":25-" + c2);
        grd.attr("id", "Gradient_" + elemid);
        Snap("g[data-element-id='" + elemid + "'] g.djs-visual rect").attr({"fill": "url(#Gradient_" + elemid + ")"});
    } else if (rId == "displayStyle_GradientColor2") {
        var grd = Snap("svg").select("#Gradient_" + elemid);
        grd && grd.remove();
        var c0 = fl.curflow.bpmnConfig[elemid]["displayStyle_GradientColor0"] || flstyle.elem.gradients.Task.a;
        var c1 = fl.curflow.bpmnConfig[elemid]["displayStyle_GradientColor1"] || flstyle.elem.gradients.Task.b;
        var c2 = nv;
        grd = Snap("svg").paper.gradient("L(0, 0, 100, 100)" + c0 + "-" + c1 + ":25-" + c2);
        grd.attr("id", "Gradient_" + elemid);
        Snap("g[data-element-id='" + elemid + "'] g.djs-visual rect").attr({"fill": "url(#Gradient_" + elemid + ")"});
    } else if (rId == "displayStyle_BorderEffect") {
        if (nv == 'none' || !nv) {
            Snap("g[data-element-id='" + elemid + "'] g.djs-visual rect").attr("filter", null);
        } else {
            Snap("g[data-element-id='" + elemid + "'] g.djs-visual rect").attr("filter", "url(#" + nv + ")");
        }
    } else if (rId == "displayStyle_BorderStrokeWidth") {
        Snap("g[data-element-id='" + elemid + "'] g.djs-visual rect").attr({"strokeWidth": parseInt(nv || flstyle.elem.defaultStrokeWidth)});
    } else if (rId == "displayStyle_BorderColor") {
        Snap("g[data-element-id='" + elemid + "'] g.djs-visual rect").attr({"stroke": nv || flstyle.elem.defaultStroke});
    } else if (rId == "displayStyle_ActivityIconColor") {
        Snap("g[data-element-id='" + elemid + "'] g.djs-visual").selectAll("path").forEach(function (el) {
            el.attr({"stroke": nv || flstyle.elem.defaultActivityIconColor});
        });
    } else if (rId == "displayStyle_fontColor") {
        Snap("g[data-element-id='" + elemid + "'] g.djs-visual text").attr({"fill": nv || flstyle.elem.defaultFontColor});
    } else if (rId == "displayStyle_showActivityIcon") {
        Snap("g[data-element-id='" + elemid + "'] g.djs-visual").selectAll("path").forEach(function (el) {
            var sval = "";
            var styles = el.attr("style");
            if (styles) {
                var sa = styles.split(";");
                if (sa && sa.length) {
                    for (var i in sa) {
                        if ($.trim(sa[i])) {
                            var sas = $.trim(sa[i]).split(":");
                            if ("display" != sas[0]) sval += sas[0] + ":" + $.trim(sas[1]) + ";";
                        }
                    }
                }
            }
            sval += (flstyle.elem.defaultActivityIconShow == nv ? "" : "display:none;");
            el.attr({"style": sval});
        });
    }
};

//properties settings for block
fldmeta_prop.control.UserTask = {
    "includes-properties": {
        "common": fldmeta_prop.common.all.properties,
        "activitycommon": fldmeta_prop.common.activity.properties
    },
    "properties": {
        "formBinding": fldmeta_prop.func.UserTask.predefined["formBinding"],
        "taskAssign": {
            "name": fmd_i18n_prop_taskAssign,
            "img": "userTaskType.png",
            "cellType": "ro",
            "displayOnly": true,
            "sub": {
                "assigneeType": {
                    "name": fmd_i18n_prop_assignee,
                    "img": "roleactivity.png",
                    "cellType": {
                        "type": "coro",
                        "options": fmd_i18n_prop_assigneeTypes
                    },
                    "value": {"default": "user"},
                    "conditional-sub": {
                        "user": {
                            "assigneeUser": {
                                "name": fmd_i18n_prop_assignee_user,
                                "img": "roleactivity.png",
                                "asterisk": true,
                                "cellType": {
                                    "type": "btnex",
                                    "config": {
                                        "displayValue": "names",
                                        "onclick": fldmeta_prop.func.UserTask.selectUser,
                                        "ishidebtn": function () {
                                            return !fmdc.grid_prop.isEditor
                                        }
                                    }
                                },
                                "validatorFunc": function (elemid, value, prefix) {
                                    if (fl.curflow.bpmnConfig[elemid].assigneeType == "user" && MyUtilJs.isEmpty(value)) {
                                        fl_pushValidationErr(elemid, "assigneeUser", "error", prefix + fmd_i18n_vld_failed + " " + fmd_i18n_vld_notempty);
                                    }
                                }
                            }
                        },
                        "role": {
                            "assigneeRole": {
                                "name": fmd_i18n_prop_assignee_role,
                                "img": "roleactivity.png",
                                "asterisk": true,
                                "cellType": {
                                    "type": "btnex",
                                    "config": {
                                        "displayValue": "roleName",
                                        "onclick": fldmeta_prop.func.UserTask.selectRole,
                                        "ishidebtn": function () {
                                            return !fmdc.grid_prop.isEditor
                                        }
                                    }
                                },
                                "validatorFunc": function (elemid, value, prefix) {
                                    if (fl.curflow.bpmnConfig[elemid].assigneeType == "role") {
                                        if (MyUtilJs.isEmpty(value)) {
                                            fl_pushValidationErr(elemid, "assigneeRole", "error", prefix + fmd_i18n_vld_failed + " " + fmd_i18n_vld_notempty);
                                        } else {
                                            if (!fl.curflow.otherConfig.validationData[elemid]["assigneeRole"]) {
                                                fl_pushValidationErr(elemid, "assigneeRole", "error", prefix + fmd_i18n_msg_notvalidagain);
                                            }
                                        }
                                    }
                                }
                            }
                        },
                        "position": {
                            "assigneePosition": {
                                "name": fmd_i18n_prop_assignee_position,
                                "img": "roleactivity.png",
                                "asterisk": true,
                                "cellType": {
                                    "type": "btnex",
                                    "config": {
                                        "displayValue": "displayValue",
                                        "onclick": fldmeta_prop.func.UserTask.selectPosition,
                                        "ishidebtn": function () {
                                            return !fmdc.grid_prop.isEditor
                                        }
                                    }
                                },
                                "validatorFunc": function (elemid, value, prefix) {
                                    if (fl.curflow.bpmnConfig[elemid].assigneeType == "position" && MyUtilJs.isEmpty(value)) {
                                        fl_pushValidationErr(elemid, "assigneePosition", "error", prefix + fmd_i18n_vld_failed + " " + fmd_i18n_vld_notempty);
                                    }
                                }
                            }
                        },
                        "pgposition": {
                            "assigneePgPosition": {
                                "name": fmd_i18n_prop_assignee_pgposition,
                                "img": "roleactivity.png",
                                "asterisk": true,
                                "cellType": {
                                    "type": "btnex",
                                    "config": {
                                        "displayValue": "displayValue",
                                        "onclick": fldmeta_prop.func.UserTask.selectPgPosition,
                                        "ishidebtn": function () {
                                            return !fmdc.grid_prop.isEditor
                                        }
                                    }
                                },
                                "validatorFunc": function (elemid, value, prefix) {
                                    if (fl.curflow.bpmnConfig[elemid].assigneeType == "pgposition" && MyUtilJs.isEmpty(value)) {
                                        fl_pushValidationErr(elemid, "assigneePgPosition", "error", prefix + fmd_i18n_vld_failed + " " + fmd_i18n_vld_notempty);
                                    }
                                }
                            }
                        },
                        "relation": {
                            "assigneeRelationSubject": {
                                "name": fmd_i18n_prop_relation_subject,
                                "img": "roleactivity.png",
                                "cellType": {
                                    "type": "coro",
                                    "options": fmd_i18n_prop_subjectTypes
                                },
                                "value": {"default": "creator"},
                                "conditional-sub": {
                                    "previousTaskowner": {
                                        "assigneeRelationSubjectActivity": {
                                            "name": fmd_i18n_prop_assignee_relationpreactivity,
                                            "img": "roleactivity.png",
                                            "asterisk": true,
                                            "cellType": {
                                                "type": "btnex",
                                                "config": {
                                                    "displayValue": "activityName",
                                                    "onclick": fldmeta_prop.func.UserTask.selectPreActivity,
                                                    "ishidebtn": function () {
                                                        return !fmdc.grid_prop.isEditor
                                                    }
                                                }
                                            },
                                            "validatorFunc": function (elemid, value, prefix) {
                                                if (fl.curflow.bpmnConfig[elemid].assigneeType == "relation"
                                                    && fl.curflow.bpmnConfig[elemid].assigneeRelationSubject == "previousTaskowner") {
                                                    if (MyUtilJs.isEmpty(value)) {//非空验证
                                                        fl_pushValidationErr(elemid, "assigneeRelationSubjectActivity", "error", prefix + fmd_i18n_vld_failed + " " + fmd_i18n_vld_notempty);
                                                    } else {//有效性验证
                                                        if (!fl.curflow.bpmnConfig[value.activityId]) {
                                                            fl_pushValidationErr(elemid, "assigneeRelationSubjectActivity", "error", prefix + fmd_i18n_msg_activityMissing + value.activityName + "(" + value.activityId + ")");
                                                        } else {
                                                            var ispre = fldmeta_prop.func.UserTask.isPreActivity(elemid, value.activityId, fl.curflow.otherConfig.validationData.diagramJson);
                                                            if (!ispre) {
                                                                fl_pushValidationErr(elemid, "assigneeRelationSubjectActivity", "error", prefix + fmd_i18n_msg_activityNotPre + value.activityName + "(" + value.activityId + ")");
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    },
                                    "formvar": {
                                        "assigneeRelationSubjectFormvar": {
                                            "name": fmd_i18n_prop_assignee_formvar,
                                            "img": "roleactivity.png",
                                            "asterisk": true,
                                            "cellType": {
                                                "type": "btnex",
                                                "config": {
                                                    "displayValue": "displayValue",
                                                    "onclick": fldmeta_prop.func.UserTask.selectFormvar,
                                                    "ishidebtn": function () {
                                                        return !fmdc.grid_prop.isEditor
                                                    }
                                                }
                                            },
                                            "validatorFunc": function (elemid, value, prefix) {
                                                if (fl.curflow.bpmnConfig[elemid].assigneeType == "relation"
                                                    && fl.curflow.bpmnConfig[elemid].assigneeRelationSubject == "formvar") {
                                                    if (MyUtilJs.isEmpty(value)) {
                                                        fl_pushValidationErr(elemid, "assigneeRelationSubjectFormvar", "error", prefix + fmd_i18n_vld_failed + " " + fmd_i18n_vld_notempty);
                                                    } else {
                                                        try {
                                                            var b1 = fl.curflow.otherConfig.validationData[elemid]['bindedFormModels'].input[value.parentvarname].children[value.varname]!=undefined;
                                                            if (!b1) fl_pushValidationErr(elemid, "assigneeRelationSubjectFormvar", "error", prefix + fmd_i18n_msg_invalidbindingformvar + value.parentvarname + "." + value.varname);
                                                        } catch (e) {
                                                            //console.log(e);
                                                            fl_pushValidationErr(elemid, "assigneeRelationSubjectFormvar", "error", prefix + fmd_i18n_msg_invalidbindingformvar + value.parentvarname + "." + value.varname);
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    },
                                    "processvar": {
                                        "assigneeRelationSubjectProcessvar": {
                                            "name": fmd_i18n_prop_assignee_processvar,
                                            "img": "roleactivity.png",
                                            "asterisk": true,
                                            "cellType": {
                                                "type": "btnex",
                                                "config": {
                                                    "displayValue": "displayValue",
                                                    "onclick": fldmeta_prop.func.UserTask.selectProcessvar,
                                                    "ishidebtn": function () {
                                                        return !fmdc.grid_prop.isEditor
                                                    }
                                                }
                                            },
                                            "validatorFunc": function (elemid, value, prefix) {
                                                if (fl.curflow.bpmnConfig[elemid].assigneeType == "relation"
                                                    && fl.curflow.bpmnConfig[elemid].assigneeRelationSubject == "processvar") {
                                                    if (MyUtilJs.isEmpty(value)) {
                                                        fl_pushValidationErr(elemid, "assigneeRelationSubjectProcessvar", "error", prefix + fmd_i18n_vld_failed + " " + fmd_i18n_vld_notempty);
                                                    } else {
                                                        if (!fldmeta_prop.func.isValidProcessVar(value.varname)) {
                                                            fl_pushValidationErr(elemid, "assigneeRelationSubjectProcessvar", "error", prefix + fmd_i18n_msg_invalidmappingpvar + value.varname);
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            },
                            "assigneeRelationRelation": {
                                "name": fmd_i18n_prop_relation,
                                "img": "roleactivity.png",
                                "cellType": {
                                    "type": "coro",
                                    "options": fmd_i18n_prop_relationTypes
                                },
                                "value": {"default": "same"},
                                "conditional-sub": {
                                    "position": {
                                        "assigneeRelationRelationPosition": {
                                            "name": fmd_i18n_prop_assignee_relationpostion,
                                            "img": "roleactivity.png",
                                            "asterisk": true,
                                            "cellType": {
                                                "type": "btnex",
                                                "config": {
                                                    "displayValue": "posName",
                                                    "onclick": fldmeta_prop.func.UserTask.selectRelationPosition,
                                                    "ishidebtn": function () {
                                                        return !fmdc.grid_prop.isEditor
                                                    }
                                                }
                                            },
                                            "validatorFunc": function (elemid, value, prefix) {
                                                if (fl.curflow.bpmnConfig[elemid].assigneeType == "relation"
                                                    && fl.curflow.bpmnConfig[elemid].assigneeRelationRelation == "position") {
                                                    if (MyUtilJs.isEmpty(value)) {
                                                        fl_pushValidationErr(elemid, "assigneeRelationRelationPosition", "error", prefix + fmd_i18n_vld_failed + " " + fmd_i18n_vld_notempty);
                                                    } else {
                                                        if (!fl.curflow.otherConfig.validationData[elemid]["assigneeRelationRelationPosition"]
                                                            || fl.curflow.otherConfig.validationData[elemid]["assigneeRelationRelationPosition"].isvalid != 1) {
                                                            fl_pushValidationErr(elemid, "assigneeRelationRelationPosition", "error", prefix + fmd_i18n_msg_notvalidagain);
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    },
                                    "pgposition": {
                                        "assigneeRelationRelationPgPosition": {
                                            "name": fmd_i18n_prop_assignee_relationpgpostion,
                                            "img": "roleactivity.png",
                                            "asterisk": true,
                                            "cellType": {
                                                "type": "btnex",
                                                "config": {
                                                    "displayValue": "posName",
                                                    "onclick": fldmeta_prop.func.UserTask.selectRelationPosition,
                                                    "ishidebtn": function () {
                                                        return !fmdc.grid_prop.isEditor
                                                    }
                                                }
                                            },
                                            "validatorFunc": function (elemid, value, prefix) {
                                                if (fl.curflow.bpmnConfig[elemid].assigneeType == "relation"
                                                    && fl.curflow.bpmnConfig[elemid].assigneeRelationRelation == "pgposition") {
                                                    if (MyUtilJs.isEmpty(value)) {
                                                        fl_pushValidationErr(elemid, "assigneeRelationRelationPgPosition", "error", prefix + fmd_i18n_vld_failed + " " + fmd_i18n_vld_notempty);
                                                    } else {
                                                        if (!fl.curflow.otherConfig.validationData[elemid]["assigneeRelationRelationPgPosition"]
                                                            || fl.curflow.otherConfig.validationData[elemid]["assigneeRelationRelationPgPosition"].isvalid != 1) {
                                                            fl_pushValidationErr(elemid, "assigneeRelationRelationPgPosition", "error", prefix + fmd_i18n_msg_notvalidagain);
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        },
                        "ruletable": {
                            // TODO
                        }
                    }
                },
                "assignType": fldmeta_prop.func.UserTask.predefined["assignType"]/*,
                 "allowSelectAssignee" : {
                 "name" : fmd_i18n_prop_allowselectassignee,
                 "img" : "multiApprovalEvaluation.png",
                 "tooltip" : fmd_i18n_tip_allowselectassignee,
                 "cellType" : "ch",
                 "value" : {"default":0}
                 },
                 "assistantType" : {
                 "name" : fmd_i18n_prop_assistant,
                 "img" : "roleactivity.png",
                 "cellType" : {
                 "type" : "coro",
                 "options" : fmd_i18n_prop_assistantTypes
                 },
                 "value" : {"default":"none"}
                 },
                 "readerType" : {
                 "name" : fmd_i18n_prop_reader,
                 "img" : "roleactivity.png",
                 "cellType" : {
                 "type" : "coro",
                 "options" : fmd_i18n_prop_readerTypes
                 },
                 "value" : {"default":"none"}
                 }*/
            }
        },
        "taskOperations": {
            "name": fmd_i18n_prop_taskOperations,
            "img": "taskOperations.png",
            "tooltip": fmd_i18n_prop_taskOperations,
            "cellType": "ro",
            "displayOnly": true,
            "sub": {
                "isApprovalActivity": fldmeta_prop.func.UserTask.predefined["isApprovalActivity"],
                "allowReject": fldmeta_prop.func.UserTask.predefined["allowReject"],
                "allowInvolve": fldmeta_prop.func.UserTask.predefined["allowInvolve"],
                "allowReassign": {
                    "name": fmd_i18n_prop_allowReassign,
                    "img": "allowReassign.png",
                    "tooltip": fmd_i18n_prop_allowReassign,
                    "cellType": "ch",
                    "value": {"default": 0}
                },
                "allowRecall": {
                    "name": fmd_i18n_prop_allowRecall,
                    "img": "allowRecall.png",
                    "tooltip": fmd_i18n_prop_allowRecall,
                    "cellType": "ch",
                    "value": {"default": 0}
                }
            }
        },
        "autoSkip": {
            "name": fmd_i18n_prop_autoSkip,
            "img": "skip.png",
            "tooltip": fmd_i18n_prop_autoSkip,
            "cellType": "ro",
            "displayOnly": true,
            "sub": {
                "skipOnVoidAssignee": {
                    "name": fmd_i18n_prop_skipOnVoidAssignee,
                    "img": "skip.png",
                    "tooltip": fmd_i18n_prop_skipOnVoidAssignee,
                    "cellType": "ch",
                    "value": {"default": 0}
                },
                "skipOnSameAssignee": {
                    "name": fmd_i18n_prop_skipOnSameAssignee,
                    "img": "skip.png",
                    "tooltip": fmd_i18n_prop_skipOnSameAssignee,
                    "cellType": "ch",
                    "value": {"default": 0}
                }
            }
        },
        "hasten": {
            "name": fmd_i18n_prop_durationhasten,
            "img": "duration.png",
            "tooltip": fmd_i18n_prop_durationhasten,
            "cellType": "ro",
            "displayOnly": true,
            "sub": {
                "duration": fldmeta_prop.common.predefined["duration"],
                "remind": fldmeta_prop.common.predefined["remind"],
                /*"skipOnTimeout" : {
                 "name" : fmd_i18n_prop_skipOnTimeout,
                 "img" : "skip.png",
                 "tooltip" : fmd_i18n_prop_skipOnTimeout,
                 "cellType" : "ch",
                 "value" : {"default":0}
                 },*/
                "manualRemind": fldmeta_prop.common.predefined["manualRemind"]
            }
        },
        "newTaskRemind": fldmeta_prop.func.UserTask.predefined["newTaskRemind"],
        "priority" : {
            "name": fmd_i18n_prop_priority,
            "img": "priority.png",
            "tooltip": fmd_i18n_tip_priority,
            "cellType": {
                "type": "coro",
                "options": fmd_i18n_prop_priority_enum
            },
            "value": {"default": "10"}
        },
        "allowAttach" : {
            "name" : fmd_i18n_prop_allowattach,
            "img" : "attachment.png",
            "tooltip" : fmd_i18n_prop_allowattach,
            "cellType" : "ch",
            "value" : {"default":"0"},
            "conditional-sub" : {
                "1" : {
                    "attachAction" : {
                        "name" : fmd_i18n_prop_allowattachaction,
                        "img" : "attachment.png",
                        "tooltip" : fmd_i18n_prop_allowattachaction,
                        "cellType" : {
                            "type" : "coro",
                            "options": fmd_i18n_prop_involveType_attachaction
                        },
                        "value" : {"default":"0"}
                    }
                }
            }
        }
    },
    "styles": {
        "displayStyle": {
            "name": fmd_i18n_prop_tip_customstyle,
            "img": "css.png",
            "cellType": {
                "type": "coro",
                "options": fmd_i18n_prop_displayStyle_vals
            },
            "value": {"default": "theme"},
            "conditional-sub": {
                "custom": {
                    "displayStyle_GradientColor0": {
                        "name": fmd_i18n_prop_color0,
                        "cellType": "cp",
                        "img": "color.png",
                        "value": function () {
                            return flstyle.elem.gradients.Task.a
                        }
                    },
                    "displayStyle_GradientColor1": {
                        "name": fmd_i18n_prop_color1,
                        "cellType": "cp",
                        "img": "color.png",
                        "value": function () {
                            return flstyle.elem.gradients.Task.b
                        }
                    },
                    "displayStyle_GradientColor2": {
                        "name": fmd_i18n_prop_color2,
                        "cellType": "cp",
                        "img": "color.png",
                        "value": function () {
                            return flstyle.elem.gradients.Task.c
                        }
                    },
                    //"displayStyle_ActivityIconColor" : fldmeta_prop.common.predefined["displayStyle_ActivityIconColor"],
                    "displayStyle_fontColor": function () {
                        var obj1 = MyUtilJs.copyObj(fldmeta_prop.common.predefined["displayStyle_fontColor"]);
                        obj1.value["default"] = flstyle.elem.defaultFontColor;
                        return obj1;
                    },
                    "displayStyle_BorderStrokeWidth": function () {
                        var obj1 = MyUtilJs.copyObj(fldmeta_prop.common.predefined["displayStyle_BorderStrokeWidth"]);
                        obj1.value["default"] = flstyle.elem.attrs.usertask.strokeWidth;
                        return obj1;
                    },
                    "displayStyle_BorderColor": function () {
                        var obj1 = MyUtilJs.copyObj(fldmeta_prop.common.predefined["displayStyle_BorderColor"]);
                        obj1.value["default"] = flstyle.elem.attrs.usertask.stroke;
                        return obj1;
                    },
                    "displayStyle_BorderEffect": fldmeta_prop.common.predefined["displayStyle_BorderEffect"]
                }
            }
        }
    },
    "abandon-properties": fldmeta_prop.func.getAbandonPropertiesForConditional,
    "validationDataPrepare": {//验证时用到的需要提前从其他系统读取的配置信息
        //读取表单绑定信息，并在页面暂存模型数据，用于验证formBinding和dataMapping两个属性
        "bindedFormModels": function (elemid) {
            var form1 = fl.curflow.bpmnConfig[elemid]["formBinding"];
            if (!MyUtilJs.isEmpty(form1)) {
                return doPostAsyncJson(flvar.fmdCtx + "/rest/fmd/getVersion", {
                        "formid": form1.formid,
                        "versionid": form1.versionid
                    },
                    function (ret) {
                        //console.log(ret);
                        if (!ret) return;
                        fl.curflow.otherConfig.validationData[elemid]["bindedFormModels"] = fldmeta_prop.func.UserTask.parseModelToInputOutput(ret);
                    }
                );
            }
            return null;
        },
        //读取引用角色信息稍后做有效性验证
        "assigneeRole": function (elemid) {
            var role1 = fl.curflow.bpmnConfig[elemid]["assigneeRole"];
            if (!MyUtilJs.isEmpty(role1)) {
                return doGetAsyncJson(flvar.restCtx + "/fa/role/" + role1.roleId + '?timezoneOffset=' + new Date().getTimezoneOffset(),
                    function (ret) {
                        fl.curflow.otherConfig.validationData[elemid]["assigneeRole"] = ret;
                    }
                );
            }
        },
        //读取引用岗位信息稍后做有效性验证
        "assigneeRelationRelationPosition": function (elemid) {
            var pos1 = fl.curflow.bpmnConfig[elemid]["assigneeRelationRelationPosition"];
            if (!MyUtilJs.isEmpty(pos1)) {
                return doGetAsyncJson(flvar.restCtx + "/fa/pos/" + pos1.posId + '?timezoneOffset=' + new Date().getTimezoneOffset(),
                    function (ret) {
                        fl.curflow.otherConfig.validationData[elemid]["assigneeRelationRelationPosition"] = ret;
                    }
                );
            }
        },
        "assigneeRelationRelationPgPosition": function (elemid) {
            var pos1 = fl.curflow.bpmnConfig[elemid]["assigneeRelationRelationPgPosition"];
            if (!MyUtilJs.isEmpty(pos1)) {
                return doGetAsyncJson(flvar.restCtx + "/fa/pos/" + pos1.posId + '?timezoneOffset=' + new Date().getTimezoneOffset(),
                    function (ret) {
                        fl.curflow.otherConfig.validationData[elemid]["assigneeRelationRelationPgPosition"] = ret;
                    }
                );
            }
        }
    },
    "propDhxGridEvents": {
        "onCellChanged": function (rId, cId, nv) {
            fldmeta_prop.func.onCellChanged_common(rId, cId, nv,
                JSONSelect.match("." + rId, fldmeta_prop.control.UserTask));
            fldmeta_prop.func.onCellChanged_stylecommon(rId, cId, nv);
        }
    }
};



